import { BaseLayer, IBaseLayerParams, RenderOptions } from './BaseLayer';

/**
 * @deprecated 此 Layer 不合理，考虑多个图层， 能否通过 制作一个 bizUnit
 */
export class FillLayer extends BaseLayer {
  areaOptions: RenderOptions = {};
  borderOptions: RenderOptions = {};
  constructor(
    cfg: IBaseLayerParams,
    areaOptions?: RenderOptions,
    borderOptions?: RenderOptions,
  ) {
    super(cfg);
    this.areaOptions = areaOptions || {};
    this.borderOptions = borderOptions || {};
  }
  addToMap(): string {
    this.map.addLayer({
      id: this.layerId,
      type: 'fill',
      source: this.sourceId,
      // "layout": this.areaOptions.layout,
      // "paint": this.areaOptions.paint
      ...this.areaOptions,
    });
    // 添加区域边界线样式
    this.map.addLayer({
      id: this.layerId + '-line',
      type: 'line',
      source: this.sourceId,
      // "layout": this.borderOptions.layout,
      // "paint": this.borderOptions.paint
      ...this.borderOptions,
    });
    // return [this.layerId]
    return this.layerId;
  }
}
